package Blog;

//初始化成员变量的方式
class Dog{
    String name = "小狗狗";
    int age = 10;
    String color = "米白色";

//    //方式一
//    public Dog(){
//        this.name = "小飞";
//        this.age = 10;
//        this.color = "粉色";
//    }

    //方式三
    public Dog(){
        this("小飞飞飞",10,"浅浅粉色");
    }


//    //方式二
    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }


    public void print(){
        System.out.println(this.name + "  " + this.age + "  " + this.color);
    }
}

public class NewTest {
    public static void main(String[] args) {
        //方式一 和 方式三
        Dog dog = new Dog();
        dog.print();


//       //方式二
//        Dog dog1 = new Dog("小飞飞",10,"浅粉色");
//        dog1.print();
    }
}
